package org.achartengine.internal.chart;

import android.graphics.Canvas;
import android.graphics.Paint;
import org.achartengine.internal.renderer.XYMultipleSeriesRenderer;

/* loaded from: classes2.dex */
public class i extends k {
    public static final String a = "Scatter";
    private static final float b = 3.0f;
    private static final int c = 10;
    private float h;
    private int i;

    @Override // org.achartengine.internal.chart.a
    public int a(int i) {
        return 10;
    }

    @Override // org.achartengine.internal.chart.k
    public String c() {
        return a;
    }

    i() {
        this.h = b;
        this.i = -1;
    }

    public i(org.achartengine.internal.model.g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        super(gVar, xYMultipleSeriesRenderer);
        this.h = b;
        this.i = -1;
        this.h = xYMultipleSeriesRenderer.af();
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // org.achartengine.internal.chart.k
    public void a(org.achartengine.internal.model.g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        super.a(gVar, xYMultipleSeriesRenderer);
        this.h = xYMultipleSeriesRenderer.af();
    }

    @Override // org.achartengine.internal.chart.k
    public void a(Canvas canvas, Paint paint, float[] fArr, org.achartengine.internal.renderer.b bVar, float f, int i) {
        org.achartengine.internal.renderer.c cVar = (org.achartengine.internal.renderer.c) bVar;
        paint.setColor(cVar.b());
        if (cVar.d()) {
            paint.setStyle(Paint.Style.FILL);
        } else {
            paint.setStyle(Paint.Style.STROKE);
        }
        int length = fArr.length;
        int i2 = 0;
        switch (AnonymousClass1.a[cVar.f().ordinal()]) {
            case 1:
                while (i2 < length) {
                    a(canvas, paint, fArr[i2], fArr[i2 + 1]);
                    i2 += 2;
                }
                return;
            case 2:
                while (i2 < length) {
                    b(canvas, paint, fArr[i2], fArr[i2 + 1]);
                    i2 += 2;
                }
                return;
            case 3:
                float[] fArr2 = new float[6];
                while (i2 < length) {
                    a(canvas, paint, fArr2, fArr[i2], fArr[i2 + 1]);
                    i2 += 2;
                }
                return;
            case 4:
                while (i2 < length) {
                    c(canvas, paint, fArr[i2], fArr[i2 + 1]);
                    i2 += 2;
                }
                return;
            case 5:
                float[] fArr3 = new float[8];
                while (i2 < length) {
                    b(canvas, paint, fArr3, fArr[i2], fArr[i2 + 1]);
                    i2 += 2;
                }
                return;
            case 6:
                canvas.drawPoints(fArr, paint);
                return;
            default:
                return;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: org.achartengine.internal.chart.i$1 */
    /* loaded from: classes2.dex */
    public static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[PointStyle.values().length];
            a = iArr;
            try {
                iArr[PointStyle.X.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[PointStyle.CIRCLE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[PointStyle.TRIANGLE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[PointStyle.SQUARE.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[PointStyle.DIAMOND.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[PointStyle.POINT.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
        }
    }

    @Override // org.achartengine.internal.chart.a
    public void a(Canvas canvas, org.achartengine.internal.renderer.b bVar, float f, float f2, int i, Paint paint) {
        org.achartengine.internal.renderer.c cVar = (org.achartengine.internal.renderer.c) bVar;
        if (cVar.d()) {
            paint.setStyle(Paint.Style.FILL);
        } else {
            paint.setStyle(Paint.Style.STROKE);
        }
        switch (AnonymousClass1.a[cVar.f().ordinal()]) {
            case 1:
                a(canvas, paint, f + 10.0f, f2);
                return;
            case 2:
                b(canvas, paint, f + 10.0f, f2);
                return;
            case 3:
                a(canvas, paint, new float[6], f + 10.0f, f2);
                return;
            case 4:
                c(canvas, paint, f + 10.0f, f2);
                return;
            case 5:
                b(canvas, paint, new float[8], f + 10.0f, f2);
                return;
            case 6:
                canvas.drawPoint(f + 10.0f, f2, paint);
                return;
            default:
                return;
        }
    }

    private void a(Canvas canvas, Paint paint, float f, float f2) {
        float f3 = this.h;
        canvas.drawLine(f - f3, f2 - f3, f + f3, f2 + f3, paint);
        float f4 = this.h;
        canvas.drawLine(f + f4, f2 - f4, f - f4, f2 + f4, paint);
    }

    private void b(Canvas canvas, Paint paint, float f, float f2) {
        canvas.drawCircle(f, f2, this.h, paint);
    }

    private void a(Canvas canvas, Paint paint, float[] fArr, float f, float f2) {
        fArr[0] = f;
        float f3 = this.h;
        fArr[1] = (f2 - f3) - (f3 / 2.0f);
        fArr[2] = f - f3;
        fArr[3] = f2 + f3;
        fArr[4] = f + f3;
        fArr[5] = fArr[3];
        a(canvas, fArr, paint, true);
    }

    private void c(Canvas canvas, Paint paint, float f, float f2) {
        float f3 = this.h;
        canvas.drawRect(f - f3, f2 - f3, f + f3, f2 + f3, paint);
    }

    private void b(Canvas canvas, Paint paint, float[] fArr, float f, float f2) {
        fArr[0] = f;
        float f3 = this.h;
        fArr[1] = f2 - f3;
        fArr[2] = f - f3;
        fArr[3] = f2;
        fArr[4] = f;
        fArr[5] = f2 + f3;
        fArr[6] = f + f3;
        fArr[7] = f2;
        a(canvas, fArr, paint, true);
    }
}
